SuperStrict

Import jmd.inputsequence



'Create a familiar "up,up,down,down,left,right,left,right,B,A,Enter" cheat code
Global livesCheat:TInputSequence = CreateInputSequence()
InSeqAddStroke(livesCheat,KEY_STROKE,KEY_UP)
InSeqAddStroke(livesCheat,KEY_STROKE,KEY_UP)
InSeqAddStroke(livesCheat,KEY_STROKE,KEY_DOWN)
InSeqAddStroke(livesCheat,KEY_STROKE,KEY_DOWN)
InSeqAddStroke(livesCheat,KEY_STROKE,KEY_LEFT)
InSeqAddStroke(livesCheat,KEY_STROKE,KEY_RIGHT)
InSeqAddStroke(livesCheat,KEY_STROKE,KEY_LEFT)
InSeqAddStroke(livesCheat,KEY_STROKE,KEY_RIGHT)
InSeqAddStroke(livesCheat,KEY_STROKE,KEY_B)
InSeqAddStroke(livesCheat,KEY_STROKE,KEY_A)
InSeqAddStroke(livesCheat,KEY_STROKE,KEY_ENTER)


'Create a  "God-Mode" cheat using InSeqAddKeyStrokesFromString()
'activated by typing "heaven" on the keyboard
Global godCheat:TInputSequence = CreateInputSequence()
InSeqAddKeyStrokesFromString(godCheat,"heaven")


'create an "add ammo" cheat that has some macro strokes!
'Activated by: KEY_UP+KEY_LEFT,KEY_SPACE,KEY_X (note that the first stroke is a macro of pressing 2 keys at once!)
Global ammoCheat:TInputSequence = CreateInputSequence(2000) 'Give a little extra time per stroke!
InSeqAddStroke(ammoCheat,KEY_STROKE,KEY_UP,1) 		'Notice that we are now specifying stroke numbers!
InSeqAddStroke(ammoCheat,KEY_STROKE,KEY_LEFT,1)		'KEY_UP and KEY_LEFT are now a "macro-stroke" for the first stroke!
InSeqAddStroke(ammoCheat,KEY_STROKE,KEY_SPACE,2)
inSeqAddStroke(ammoCheat,KEY_STROKE,KEY_X)			'Didn't specify the stroke on this one, which puts it in Auto mode...
													'This means that is will automatically be assigned the next stroke number (which would be 3 in this case)
													
'Create a "super-punch" special move
'activated by LMB,LMB,RMB,LMB,KEY_SPACE
'(LMB is Left Mouse Button, RMB is Right Mouse Button)
Global superPunch:TInputSequence = CreateInputSequence()
InSeqAddStroke(superPunch,MOUSE_STROKE,1)
inSeqAddStroke(superPunch,MOUSE_STROKE,1)
InSeqAddStroke(superPunch,MOUSE_STROKE,2)
InSeqAddStroke(superPunch,MOUSE_STROKE,1)
InSeqAddStroke(superPunch,KEY_STROKE,KEY_SPACE)




'We are starting with 3 lives
Local lives:Int = 3
'We are starting with 100 rounds of ammo
Local ammo:Int= 100

Local godModeString:String = "God Mode Active!!"

'Lets use a fun sound effect for when we perform the Livescheat code properly!
Local sndCredit:TSound=LoadSound("credit.wav")

Local kerplowTimestamp:Int





'Main loop
Graphics 640,480
While Not KeyDown(KEY_ESCAPE)
	Cls
	DrawText "Lives: " + lives, 10,10
	DrawText "Ammo: " + ammo, 500,10
	
	
	
	InSeqUpdateAll() 'must call this every iteration!!!
	
	'god mode cheat
	InSeqSuccessful(godCheat)
	If InSeqEntered(godCheat)>0 
		SetColor 255,0,0
		DrawText godModeString,GraphicsWidth()/2-TextWidth(godModeString)/2,10
		SetColor 255,255,255
	EndIf
	
	
	'ammo cheat
	If InSeqSuccessful(ammoCheat)
		If InSeqEntered(ammoCheat)>1
			Print "Oops! You can only do the ammo cheat once!"
		Else
			PlaySound sndCredit
			ammo=9999
		EndIf
	EndIf
	
	
	
	'lives cheat
	If InSeqSuccessful(livesCheat)
		PlaySound(sndCredit)
		lives:+ 30
	EndIf
	
	
	
	'Super punch sequence!
	If InSeqSuccessful(superPunch) Then kerplowTimestamp=MilliSecs()
	If InSeqEntered(superPunch)
		SetColor 255,0,0
		Local scale:Float=Sin((MilliSecs()/50)*10)
		SetScale Abs(scale)+1,Abs(scale)+1
		DrawText "KERPLOW!!!",GraphicsWidth()/2-TextWidth("KERPLOW!!")/2,GraphicsHeight()/2
		SetScale 1,1
		SetColor 255,255,255
		If MilliSecs() - kerPlowTimestamp > 3000 Then InSeqResetEntered(superPunch)
	EndIf
	
	
	ShowDebugInfo()
	Flip
Wend

End

Function ShowDebugInfo()
	DrawText "livesCheat: " + livesCheat.strokeCounter + " out of " + livesCheat.numStrokes + " strokes.",10,400
	DrawText "godCheat: " + godCheat.strokeCounter + " out of " + godCheat.NumStrokes + " strokes.",10,420
	DrawText "ammoCheat: " + ammoCheat.strokeCounter + " out of " + ammoCheat.numStrokes + " strokes.",10,440
	DrawText "superPunch: " + superPunch.StrokeCounter + " out of " + superPunch.numStrokes + " strokes.",10,460
End Function